<?php
Yii::app()->clientScript->registerScript('jobsClass',<<<HERE

        function renderActive(value,p,record){
            var text='';
            switch(record.data.inactive){
                case '-1':
                    text= 'Pending';
                    break;
                case '0':
                    text='Active';
                    break;
                case '1':
                    text='Inactive';
                    break;
            
            }
            return text;
        }   

        Ext.onReady(function(){
        var store=Ext.create('Ext.data.Store',{
            model:'JobsClass',
            pageSize:20,
            autoLoad:true,
            proxy:{
                type:'ajax',
                url:'index.php?r=jobsClass/list',
                reader:{
                    type:'json',
                    root:'data',
                    totalProperty:'totalCount'
                }
            }
        });

        Ext.create('Ext.ux.LiveSearchGridPanel',{
            store:store,
            height: 450,
            width: grid_width,
            title: 'Job Class List',
            renderTo: 'jobsclass-list',
            viewConfig: {
                stripeRows: true
            },
           
            bbar: new Ext.PagingToolbar({
                pageSize: 20,
                store:store,
                displayInfo: true,
                displayMsg: 'Displaying Job Classes {0} - {1} of {2}',
                emptyMsg: 'No Job Classes to display'

            }),
            columns:[              
                {
                    text:'Job Class Description',
                    flex:1,
                    dataIndex:'description',
                    renderer:function(value,p,record){
                        return Ext.String.format("<a href='index.php?r=jobsClass/update&id={0}'>{1}</a>",record.data.id,record.data.description);                    
                    }
                },   
                {
                    text:'Status',
                    flex:1,
                    sortable: true,
                    dataIndex:'inactive',
                    renderer: renderActive
                },                
                {
                    text:'Actions',
                    flex:1,
                    renderer:function(value,p,record){
                        return Ext.String.format('<a href="index.php?r=jobsClass/update&id={0}"><img src="images/update.png"/></a><a href="index.php?r=jobsClass/delete&id={0}"><img src="images/delete.png"/></a>',record.data.id);
                    }
                }
            ]

        });
    });
HERE
        ,CClientScript::POS_BEGIN);?>


<div id="left-col">
    <?php $this->renderPartial('_side',array(
//        'terms'=>$employee
    ));?>
</div>

<div id="right-col">

    <div class="wrap">
        <div class="container">

            
            <div id="breadcrumb" style="display:none;"><span style="padding-left:10px;font-size:10px;color:#777777;" id="alsoviewing"></span></div>
            <div class="inside">
             
                 <br/>
                 
             
                <div id="jobsclass-list"></div>


                
            </div><!-- inside -->
        </div><!-- container -->
    </div><!-- wrap -->
    <?php $this->renderPartial('/copyright'); ?>
</div> <!-- left-col -->